#include <QTimer>
#include <QApplication>
#include <QGridLayout>
#include <QWidget>

#include <osgViewer/CompositeViewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/MultiTouchTrackballManipulator>
#include <osgQt/GraphicsWindowQt>
#include <iostream>
#include <string>

#ifndef VIEWERWIDGET_H
#define VIEWERWIDGET_H

class ViewerWidget : public QWidget, public osgViewer::CompositeViewer
{
public:
	ViewerWidget(QWidget* parent = 0, Qt::WindowFlags f = 0, osgViewer::ViewerBase::ThreadingModel threadingModel = osgViewer::CompositeViewer::SingleThreaded);

	QWidget* GetWidget();

	bool addModel(const std::string& filename);

	virtual void paintEvent(QPaintEvent* event) override;

protected:
	QTimer _timer;
private:
	osgQt::GraphicsWindowQt* createGraphicsWindow(int x, int y, int w, int h, const std::string& name = "", bool windowDecoration = false);

	osgQt::GraphicsWindowQt * gw ;
	osg::ref_ptr< osg::Group > scene;
};
#endif